package com.cn.lck.controller;

import com.cn.lck.dtos.CommonDto;
import com.cn.lck.service.CommonService;
import com.cn.lck.utils.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: 通用控制器
 * @Author: lck
 **/
@RestController
@RequestMapping("/api")
public class CommonController {

    @Autowired
    private CommonService commonService;

    @PostMapping("/list")
    public AjaxResult list(@RequestBody CommonDto dto) {
        return commonService.list(dto);
    }

    @PostMapping("/addOrUpdate")
    public AjaxResult update(@RequestBody CommonDto dto) {
        return commonService.update(dto);
    }

    @PostMapping("/delete")
    public AjaxResult delete(@RequestBody CommonDto dto) {
        return commonService.delete(dto);
    }

}